/*
 * @lc app=leetcode.cn id=717 lang=cpp
 *
 * [717] 1比特与2比特字符
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
// @lc code=start
class Solution {
public:
    bool isOneBitCharacter(vector<int>& bits) {
        int n = bits.size();
        if(n == 1) {
            return true;
        }
        int i = 0;
        while(i < n - 1) {
            if(bits[i] == 1) {
                i += 2;
            }else {
                i++;
            }
        }
        return i == n-1;
    }
};
// @lc code=end

